//
//  ChoiceGoodsVerticalCollectionViewCell.m
//  Frame
//
//  Created by 这是工作本 on 16/1/7.
//  Copyright © 2016年 这是工作本. All rights reserved.
//

#import "ChoiceGoodsVerticalCollectionViewCell.h"

@interface ChoiceGoodsVerticalCollectionViewCell ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain)  UIImageView *image;
@property (nonatomic, retain) UITableView *tableV;
@end


@implementation ChoiceGoodsVerticalCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

- (void)data:(NSArray *)data
{
    for (NSInteger i = 0; i < data.count; i++) {
        
        self.image.image = [UIImage imageNamed:[data objectAtIndex:i]];
    }
    
    
}

- (void)createSubViews
{
    
    
    self.tableV = [[UITableView alloc] initWithFrame:CGRectMake(15 * ScreenWidth, 10 * ScreenHeigth, [UIScreen mainScreen].bounds.size.width - 30 * ScreenWidth, [UIScreen mainScreen].bounds.size.height - 246 * ScreenHeigth - 64) style:UITableViewStylePlain];
    self.tableV.dataSource = self;
    self.tableV.delegate = self;
    self.tableV.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableV.backgroundColor = [UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0];
    [self.contentView addSubview:self.tableV];
    
    // 添加下拉刷新
    self.tableV.header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(referenceAction)];
    
    // 添加上拉加载
    self.tableV.footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(reloateAction)];
    
  //self.image = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, self.contentView.frame.size.width - 30, 160)];
  //[self.contentView addSubview:self.image];
    
    
}

- (void)referenceAction
{
    
}

- (void)reloateAction
{
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 160 * ScreenHeigth;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSString *cellStr = @"cell";
    ImageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
    if (nil == cell) {
        
        cell = [[ImageTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellStr];
    }
    cell.backgroundColor = [UIColor colorWithRed:30 / 255.0 green:30 / 255.0 blue:30 / 255.0 alpha:1.0];
    [cell data:[self.imageArr objectAtIndex:indexPath.item]];
    //清除选中色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}



@end
